#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
class CPolygon
{
protected:
	int width;
	int height;
public:
	void setvalues(int a,int b);
	virtual int area()=0;
};
void CPolygon::setvalues(int a,int b)
{
	width=a;
	height=b;
}
class CRectangle:public CPolygon
{
public:
	int area();
};
int CRectangle::area()
{
	return(width*height);
}
class CTrangle:public CPolygon
{
public:
	int area();
};
int CTrangle::area()
{
	return (width*height/2);
}
int main()
{
	CRectangle rect;
	CTrangle trgl;
	CPolygon *ppoly1=&rect;
	CPolygon *ppoly2=&trgl;
	ppoly1->setvalues(4,5);
	ppoly2->setvalues(4,5);
	cout<<ppoly1->area()<<endl;
	cout<<ppoly2->area()<<endl;
	getch();
	return 0;
}